package com.webchat.pgc.controller.mall;


import com.webchat.common.bean.APIResponseBean;
import com.webchat.common.bean.APIResponseBeanUtil;
import com.webchat.domain.vo.request.mall.ShopSubmitRequestVO;
import com.webchat.domain.vo.response.mall.MallShopBaseVO;
import com.webchat.pgc.service.mall.MallShopService;
import com.webchat.rmi.pgc.mall.MallShopClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class MallShopController implements MallShopClient {


    @Autowired
    private MallShopService mallShopService;


    @Override
    public APIResponseBean<Long> submit(@RequestBody ShopSubmitRequestVO requestVO) {

        Long shopId = mallShopService.submit(requestVO);
        return APIResponseBeanUtil.success(shopId);
    }

    @Override
    public APIResponseBean<MallShopBaseVO> manageShopInfo(@PathVariable String userId) {

        return APIResponseBeanUtil.success(mallShopService.manageShopInfo(userId));
    }

    @Override
    public APIResponseBean<Long> manageShopId(String userId) {
        return APIResponseBeanUtil.success(mallShopService.getUserShopId(userId));
    }

    @Override
    public APIResponseBean<MallShopBaseVO> shopInfo(@RequestBody Long shopId) {


        return APIResponseBeanUtil.success(mallShopService.detail(shopId));
    }

    @Override
    public APIResponseBean<List<MallShopBaseVO>> batchGetShopListInfo(@RequestBody List<Long> shopIdList) {

        return APIResponseBeanUtil.success(mallShopService.batchGetList(shopIdList));
    }
}
